#include "CloudDiskGateway.h"
#include "Logger.h"

#include <signal.h>

#include <workflow/WFFacilities.h>

#include <iostream>

using namespace l;

using std::cout;
using std::cin;
using std::endl;

namespace
{
    static WFFacilities::WaitGroup g_wg{ 1 };

    void handleSignal(int) {
        g_wg.done();
    }

}//end of Anonymity namespace 

int main(int argc, char* argv[]) {

    //从配置文件读取端口号
    //todo

    signal(SIGINT, handleSignal);

    CloudDiskGateway server{};
    server.register_modules();

    if (server.track().start(8888) == 0) {
        server.list_routes();
        g_wg.wait();
        server.stop();
    }
    else {
        LogError("CloudDiskGateway failed start");
#ifdef BUG
        std::cout << "CloudDiskGateway start failed\n";
#endif
    }
    return 0;
}
